#ifndef __ISYS_RESOURCES__
#define __ISYS_RESOURCES__

#include "IUtility.h"


#define CREATE_THREAD_LOCK(ptrLock)\
  ptrLock = Invoke<ILock>("CThreadLock", nullptr, nullptr, 0);\

#define CREATE_PROCESS_LOCK(ptrLock)\
  ptrLock = Invoke<ILock>("CProcessLock", nullptr, nullptr, 0);\

#define CREATE_PROCESS_LOCK_PARA(ptrLock, pszName)\
  ptrLock = Invoke<ILock>("CProcessLock", pszName, nullptr, 0);\

#define CREATE_LOCK(ptrLock, pszLockType)\
  ptrLock = Invoke<ILock>(pszLockType, nullptr, nullptr, 0);\

#define CREATE_LOCK_SET(ptrLockSet)\
  ptrLockSet = Invoke<ILockSet>("CLockSet", nullptr, nullptr, 0);\

#define CREATE_GUI_TOOLS(ptrGuiTools)\
  ptrGuiTools = Invoke<IGui>("CGtGui", nullptr, nullptr, 0);\

class ILock : public virtual IObject
{
public:
	virtual const bool Lock(long long llLockTime = 0xFFFFFFFF) = 0;
	virtual const void Unlock() = 0;
};

typedef enum { emThreadLock = 0, emProcedureLock = 1 }CLockType;
typedef enum { alLeft = 0, alMiddle = 1, alRight = 2 }CAlign;

class ILockSet : public virtual IObject
{
public:
	virtual const bool Lock(const char * pszLockName, CLockType enLockType = emThreadLock) = 0;
	virtual const bool UnLock(const char * pszLockName) = 0;
	virtual ILock * GetLock(const char * pszLockName, CLockType enLockType = emThreadLock) = 0;
};

class ITrigger : public virtual IObject, public virtual IProductInstance
{
public:
	virtual void Trigger(long iValue) = 0;
	virtual unsigned long Wait(unsigned long iInterval) = 0;
	virtual void * TriggerHandle() = 0;
};

class IGui : public virtual IObject
{
public:
	virtual const bool InitCanvas(::HDC ptrSouDc, RECT & clRect, ::HDC & InitDc, ::HBITMAP & InitBmp, int iBackgroundModes = TRANSPARENT) = 0;
	virtual const bool InitFont(::HFONT & clFont, int iHeight, int iWidth = 0, const char * pszFontName = "Microsoft Sans Serif") = 0;
	virtual const bool InitBrush(::HBRUSH &clBrush, const COLORREF dwColor) = 0;
	virtual const bool InitPen(::HPEN & clPen, int iStyle, int iWidth, const COLORREF dwColor) = 0;
	virtual void InitRect(::RECT & clRect, int iLeft, int iTop, int iHeight, int iWidth) = 0;
	virtual const bool FillColor(::HDC & clHdc, ::RECT & refRect, const COLORREF dwColor) = 0;
	virtual const bool FillColor(::HDC & clHdc, int iLeft, int iTop, int iHeight, int iWidth, const COLORREF dwColor) = 0;
	virtual const bool Rectangle(::HDC & clHdc, ::RECT & refRect, const COLORREF dwBackgroundColor, const COLORREF dwLinColor, int iStyle = 0, int iLinWidth = 1) = 0;
	virtual const bool OutText(::HDC & clHdc, ::RECT & refRect, ::HFONT & clFont, const char * pszText, const COLORREF dwFontColor, const COLORREF dwBackgroundColor, CAlign emAlign = alMiddle) = 0;
};



#endif//__ISYS_RESOURCES__